package com.allianz.webapps.controllers;


import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;













import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.allianz.frame.utils.ApplicationContextUtil;
import com.allianz.frame.utils.StringUtil;
import com.allianz.webapps.https.interfaces.appEditOthers.AppEditOthers;
import com.allianz.webapps.https.interfaces.appEditOthers.pojo.AppEditOthersResponse;
import com.allianz.webapps.https.interfaces.appSaveOthers.AppSaveOthers;
import com.allianz.webapps.https.interfaces.type001.pojo.User;
import com.allianz.webapps.https.interfaces.util.HttpsUtil;
import com.allianz.webapps.https.interfaces.util.ObjectUtil;
import com.allianz.webapps.orderspojo.AppBase;
import com.allianz.webapps.orderspojo.Cover;
import com.allianz.webapps.quopojo.QuoAddProdyctsModel;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

/**
 * 
 * @author other.html页面处理
 */
@Controller
@RequestMapping(value = "main")
public class OtherController {
	@Autowired
	private ObjectMapper objectMapper;
	@Autowired
	private ObjectUtil objectUtil;
	@Autowired
	private AppEditOthers appEditOthers;

	@Autowired
	private AppSaveOthers appSaveOthers;
	
	@RequestMapping("appeditothers")
	@ResponseBody
	public String appeditothers(@RequestParam(value = "jsonParam") String jsonParam,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Map<String,Object> map = new HashMap<String,Object>();
	
		AppBase obj =objectMapper.readValue(jsonParam,AppBase.class);
		String body=objectUtil.requestParam(obj, "app.editOthers");
		return body;
	}
	
	@RequestMapping(value = "gotoOther")
	public ModelAndView gotoOther(HttpServletRequest request,
			HttpServletResponse response) {
		return new ModelAndView("views/page/other");
	}

	@RequestMapping(value = "readyOther")
	@ResponseBody
	public String readyOther(
			@RequestParam(value = "jsonParam") String jsonParam,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Map<String,Object> map = new HashMap<String,Object>();
		
		String responseBody="";
		Object obj=objectMapper.readValue(jsonParam,Object.class);
		responseBody=objectUtil.requestParam(obj, "app.saveOthers");		
	return responseBody;
	}
}
